const KOA = require('koa')
const app = new KOA()
const {router} = require('./src/middleware/router') 
const bodyParser = require('koa-bodyparser')
const session = require('koa-session')
app.keys = ['some secret hurr']
const CONFIG = {
    key: 'SESSION',   //cookie key (default is koa:sess)
    maxAge: 1000 * 1000 * 60,  // cookie的过期时间 maxAge in ms (default is 1 days)
    overwrite: true,  //是否可以overwrite    (默认default true)
    httpOnly: false, //cookie是否只有服务器端可以访问 httpOnly or not (default true)
    signed: true,   //签名默认true
    rolling: true,  //在每次请求时强行设置cookie，这将重置cookie过期时间（默认：false）
    renew: false,  //(boolean) renew session when session is nearly expired,
 };

app.use(bodyParser())
app.use(session(CONFIG, app))
router(app)
app.listen(3001, () => {
   console.log('启动成功')
}) 